package com.smarttest.common.beans;

public class GeneralResult {
	private int error;
	private String url;
	private String message;
	private Object data;

	private GeneralResult(int error, String url, String message,Object data) {
		this.error = error;
		this.url = url;
		this.message = message;
		this.data = data;
	}

	// 成功时调用的方法
	public static GeneralResult ok(String url,String message) {
		return new GeneralResult(0, url, message,null);
	}
	
	// 成功时调用的方法
	public static GeneralResult okData(String url,Object data) {
		return new GeneralResult(0, url,null,data);
    }
	
	// 成功时调用的方法
	public static GeneralResult ok(String url) {
		return new GeneralResult(0, url, null,null);
    }

	// 失败时调用的方法
	public static GeneralResult error(String url,String message) {
		return new GeneralResult(1, null, message,null);
	}
	
	public static GeneralResult error(String message) {
		return new GeneralResult(1, null, message,null);
	}
	
	public int getError() {
		return error;
	}
	public void setError(int error) {
		this.error = error;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
}
